﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <!-- JavaScript Includes -->
    <script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.22.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.blockUI.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/JGrowl/jquery.jgrowl_minimized.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jMenu.jquery.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.timepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/date.format.js")" type="text/javascript"></script>
    <!-- Style Sheets -->
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/JGrowl/jquery.jgrowl.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/Content/themes/cupertino/jquery-ui-1.8.22.custom.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/Content/jMenu.jquery.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/Content/jquery.ui.timepicker.css")" rel="stylesheet" type="text/css"/>
    @RenderSection("HeaderIncludes", false)
    
    <!-- Google Analytics -->
    <script type="text/javascript">

        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-35022346-1']);
        _gaq.push(['_setDomainName', 'belmontbaptist.org.au']);
        _gaq.push(['_trackPageview']);

        (function () {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();

    </script>   
</head>
<body>
    <script language="javascript" type="text/javascript">
        function ToggleMinusAdd(source) {
            if ($(source).attr('src') == '@Url.Content("~/Content/Images/add.png")') {
                $(source).attr('src', '@Url.Content("~/Content/Images/minus.png")');
            } else {
                $(source).attr('src', '@Url.Content("~/Content/Images/add.png")');
            }
        }

        function ToggleHideShow(source, targetId) {
            $("#" + targetId).toggle();
            ToggleMinusAdd(source);
        }
    </script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            // This is all text inputs ---------------------------------------
            $("input[type=text], textarea, select, input[type=password]").addClass("idle");

            $("input[type=text], textarea, select, input[type=password]").focus(function () {
                $(this).addClass("activeField").removeClass("idle");
            }).blur(function () {
                $(this).removeClass("activeField").addClass("idle");
            });

            // All Date Time inputs ------------------------------------------        
            $(function () {
                $(".JDateTime").datepicker();
            });
            $(".JDateTime").datepicker(
                {
                    minDate: new Date(2000, 1 - 1, 1),
                    dateFormat: 'dd/mm/yy',
                    changeMonth: true,
                    changeYear: true
                }
            );

            $(".JDateTime").addClass("idle");
            $(".JDateTime").focus(function () {
                $(this).addClass("activeField").removeClass("idle");
            }).blur(function () {
                $(this).removeClass("activeField").addClass("idle");
            });

            $(".JDateTime").keyup(function (evt) {
                if (evt.keyCode != '8') {
                    if (evt.target.value.length == 2) evt.target.value = evt.target.value + "/";
                    if (evt.target.value.length == 5) evt.target.value = evt.target.value + "/";
                }
                if (evt.target.value.length >= 11) {
                    evt.target.value = evt.target.value.substring(0, 10);
                }
            });

            // Menu Options ---------------------------------------------------
            $("#jMenu").jMenu();

            // Generic Ajax Error Handling...
            $.ajaxSetup({
                error: function (jqXHR, exception) {
                    if (jqXHR.status === 0) {
                        $.jGrowl('Not connect.\n Verify Network.', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else if (jqXHR.status == 404) {
                        $.jGrowl('Requested page not found. [404]', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else if (jqXHR.status == 500) {
                        $.jGrowl('Internal Server Error [500].', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else if (exception === 'parsererror') {
                        $.jGrowl('Requested JSON parse failed.', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else if (exception === 'timeout') {
                        $.jGrowl('Time out error.', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else if (exception === 'abort') {
                        $.jGrowl('Ajax request aborted.', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else {
                        $.jGrowl('Uncaught Error.\n' + jqXHR.responseText, { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    }
                }
            });
        });
    </script>
    @if (User.Identity.IsAuthenticated)
    {
        <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                // Menu Options ---------------------------------------------------
                $("#jMenu").jMenu();
            });
        </script>
    }
    <!-- This will setup the messaging for the jgrowl system -->
    @if (ViewBag.SuccessMessage != null)
    {
        // Is there any messages???
        <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                $.jGrowl('@Html.Raw(ViewBag.SuccessMessage)', { header: 'Success', sticky: true, theme: 'successGrowlUI' });
            });
        </script>
    }
    @if (ViewBag.ErrorMessage != null)
    {
        // Is there any messages???
        <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                $.jGrowl('@Html.Raw(ViewBag.ErrorMessage)', { header: 'Warning', sticky: true, theme: 'alertGrowlUI' });
            });
        </script>
    }
    @if (ViewBag.Message != null)
    {
        // Is there any messages???
        <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                $.jGrowl('@Html.Raw(ViewBag.Message)', { header: 'Message', sticky: true, theme: 'messageGrowlUI' });
            });
        </script>
    }
    <div id="page-header">
        <div class="header-resize">
            <div id="header-title" onclick="javascript:window.location = '@(Url.Action("Index", "Home", new { area = "" }))'">
                Tahor CRM
                <img alt="tahor" src="@Url.Content("~/Content/Images/Logos/Logo_64px.png")" class="header-logo" />
            </div>
            <div id="header-logo">
            </div>
            <div id="header_tools">
                <ul>
                    <li>@Html.ActionLink("Home", "Index", new { area = "", controller = "Home" })</li>
                    <li>@Html.ActionLink("About Me", "AboutMe", new { area = "", controller = "Home" })</li>
                    @if (!User.Identity.IsAuthenticated)
                    {
                        <li>@Html.ActionLink("Log In", "LogIn", new { area = "", controller = "Account" })</li>
                    }
                    else
                    {
                        <li>@Html.ActionLink("Log Off", "LogOff", new { area = "", controller = "Account" })</li>
                    }
                </ul>
            </div>
            <div class="clear">
            </div>
        </div>
    </div>

    @if (User.Identity.IsAuthenticated)
    {
        <div id="headermenu">
            <div class="headermenu-resizer">
                <ul id="jMenu">
                    <li><a href="@Url.Action("Index", new { Controller = "Home", Area = "" })"  class="fNiv">
                        Home</a> </li>
                    <li><a href="@Url.Action("Index", new { Controller = "Contact", Area = "Contacts" })"  class="fNiv">
                            Contacts</a>
                        <ul>
                            <li>@Html.ActionLink("Contacts", "Index", new { Controller = "Contact", Area = "Contacts" })</li>
                            @if (User.Identity.Name == "scossgrove")
                            {
                                <li>@Html.ActionLink("Edit Stephen Cossgrove", "Details", new { Controller = "Contact", Area = "Contacts", id = 81 })</li>
                            }
                        </ul>
                    </li>
                    @if (User.IsInRole("CanEditEvents"))
                    {
                        <li><a href="@Url.Action("Index", new {Controller = "Event", Area = "Events"})"  class="fNiv">
                                Events</a>
                            <ul>
                                <li>@Html.ActionLink("Event", "Index", new {Controller = "Event", Area = "Events"})</li>
                            </ul>
                        </li>
                    }
                    @if (User.IsInRole("Admin") || User.IsInRole("SuperUser"))
                    {
                        <li><a href="@Url.Action("Index", new { Controller = "Admin", Area = "Admin" })" class="fNiv">
                            Administration</a>
                            <ul>
                                <li><a href="">General</a>
                                    <ul>
                                        <li>@Html.ActionLink("Address Types", "Index", new { Controller = "AddressType", Area = "Admin" })</li>
                                        <li>@Html.ActionLink("Avatar Types", "Index", new { Controller = "AvatarType", Area = "Admin" })</li>
                                        <li>@Html.ActionLink("Comment Types", "Index", new { Controller = "CommentType", Area = "Admin" })</li>
                                        <li>@Html.ActionLink("Gender", "Index", new { Controller = "Gender", Area = "Admin" })</li>
                                        <li>@Html.ActionLink("Title", "Index", new { Controller = "Title", Area = "Admin" })</li>
                                        <li>@Html.ActionLink("Note Types", "Index", new { Controller = "NoteType", Area = "Admin" })</li>
                                    </ul>
                                </li>
                                <li><a href="">Contact</a>
                                    <ul>
                                        <li>@Html.ActionLink("Contact Detail Types", "Index", new { Controller = "ContactDetailType", Area = "Admin" })</li>
                                        <li>@Html.ActionLink("Contact Event Types", "Index", new { Controller = "ContactEventType", Area = "Admin" })</li>
                                        <li>@Html.ActionLink("Contact Relationship Types", "Index", new { Controller = "ContactRelationshipType", Area = "Admin" })</li>
                                    </ul>
                                </li>
                                <li><a href="">Security</a>
                                    <ul>
                                        <li>@Html.ActionLink("Role", "Index", new { Controller = "Role", Area = "Admin" })</li>
                                        <li>@Html.ActionLink("Right", "Index", new { Controller = "Right", Area = "Admin" })</li>
                                        <li>@Html.ActionLink("User", "Index", new { Controller = "User", Area = "Admin" })</li>
                                    </ul>
                                </li>
                                <li><a href="">Logging</a>
                                    <ul>
                                        <li>@Html.ActionLink("Logging", "Index", new { Controller = "Logging", Area = "Admin" })</li>
                                    </ul>
                                </li>
                            </ul>
                        </li>
                        <li><a href="" class="fNiv">Error Handling</a>
                            <ul>
                                <li><a href="/crm/elmah.axd">Elmah logging</a></li>
                            </ul>
                        </li>
                    }
                </ul>
            </div>
        </div>
    }

    <div id="page-wrapper">
        <div class="wrapper-resize-fullwidth">
            <div id="page-menu">
                @RenderSection("SubNavigation", required: false)
                <div class="clear">
                </div>
            </div>
            <div id="page-content">
                @RenderBody()
            </div>
        </div>
    </div>
    <div id="page-footer">
        <div class="footer_resize">
            <p class="left">
                Copyright © 2012 Belmont Baptist Church</p>
            <p class="right">
            </p>
            <div class="clr">
            </div>
        </div>
    </div>
</body>
</html>
